package com.codedef.service;

import io.helidon.webserver.Routing;
import io.helidon.webserver.ServerRequest;
import io.helidon.webserver.ServerResponse;
import io.helidon.webserver.Service;

import javax.json.Json;
import javax.json.JsonObject;


public class UserService implements Service {

    @Override
    public void update(Routing.Rules rules) {
        rules
                .get("/login", this::getLoginHandler);
    }

    private void getLoginHandler(ServerRequest request, ServerResponse response) {
        System.out.println("getLoginHandler 被调用");
        JsonObject jsonObj = Json.createObjectBuilder()
                .add("state", "SUCCESS")
                .add("code", 200)
                .add("message", "我我我我我我哦我我我我")
                .build();
        response.send(jsonObj);
    }
}
